home *** CD-ROM | disk | FTP | other *** search
Wrap
'$define debug '$include 'setupapi.inc' '$include 'msdetect.inc' '$INCLUDE 'mscpydis.inc' ''System ''Standard Dialog ID's : Make sure these are consistent with STDCUI.H file. const WELCOME = 100 const ASKQUIT = 200 const DESTPATH = 300 const EXITQUIT = 600 const EXITSUCCESS = 700 CONST EXITFAILURE = 400 CONST APPHELP = 900 CONST CHECK = 2500 CONST SMALLWIN = 2200 CONST RESTART = 2600 CONST RESTARTII = 2700 ''Custom Dialog ID's : Make sure these are consistent with CUIDLG.H file. const SELECTMODE = 6201 const SELECTCHIP = 6202 const SELECTSIZE = 6203 const TOOBIG = 6204 const SELECTCLIPS = 6205 const SELECTPLAYER = 6206 const NEWEXTWARNING = 6207 const CHOOSECDROM = 6208 '' Error IDs const ERR_BADVGAMODE = 8000 const ERR_BADCPU = 8001 const ERR_BADWINDOWSPATH = 8002 const ERR_BADPATH = 8003 ''Bitmap ID const LOGO = 6101 ''Bitmap ID CONST VFWLOGO = 1 ''Chip sets : Make sure these are consistent with the WhatVga DLL const CIRRUS = 100 const EVEREX = 101 const PARADISE = 102 const TSENG = 103 const TRIDENT = 104 const T8900 = 105 const ATIVGA = 106 const AHEADA = 107 const AHEADB = 108 const OAKTECH = 109 const VIDEO7 = 110 const CHIPSTECH = 111 const TSENG4 = 112 const GENOA = 113 const NCR = 114 const COMPAQ = 115 const UNKNOWN = -1 ''User interface DLL name const UIDll$ = "cui.dll" ''Constants for functions ''GetProcessor const IS386 = 3 ''GetDeviceCaps const NUMCOLORS = 24 const SIZEPALETTE = 104 '' Global variable declaration global ExpertPath$ ''Default destination directory. global WindowsDir$ ''Windows directory. global ExpertIniPath$ ''Path to the INI file to be used GLOBAL SizeReq& '' Total Disk Size required for installation ''File Types GLOBAL WinDir$ GLOBAL WinSysDir$ GLOBAL WinSys32Dir$ GLOBAL WINDRIVE$ ''Windows Drive Letter. GLOBAL CHECKSTATES$ GLOBAL MinorVer% GLOBAL OnNT$ '' functions/procedure declaration declare sub ConfirmQuit declare function MakePath (szDir$, szFile$) as string declare function GetColors() as integer DECLARE SUB VFW_Install DECLARE SUB VFW_Init '' External function/procedure declaration DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER DECLARE FUNCTION VflatdPresent LIB "iniupd.DLL" AS INTEGER DECLARE SUB Reboot LIB "iniupd.dll" DECLARE fUNCTION ExitWindowsExec LIB "User" (Exec$, Param$) AS INTEGER declare function GetDC lib "USER.EXE" (hwnd%) as integer declare function ReleaseDC lib "USER.EXE" (hwnd%, hdc%) as integer declare function GetDeviceCaps lib "GDI.EXE" (hdc%, iCapabilities%) as integer Init: '' Start here '' Set up the error traps on error goto HandleError '' Set up the way the install program looks SetBitmap UIDll$, LOGO SetTitle "Expert Movie Clips Screen Saver Setup" '' Make sure proper hardware is there if GetProcessorType() < IS386 then '' We aren't on a 386 or above. FATAL! error ERR_BADCPU end if i% = GetColors() if i% <= 16 then '' make sure we didn't just wrap around... if i% >= 0 then '' We don't have a VGA driver with 256 colors '' installed. FATAL! error ERR_BADVGAMODE end if end if '' Find the INF file szInfPath$ = GetSymbolValue("STF_SRCINFPATH") if szInfPath$ = "" then '' No predefined path for INF file, so just assume it is in '' the current directory. szInfPath$ = GetSymbolValue("STF_CWDDIR") + "EXPERT.INF" end if '' Load in the INF file ReadInfFile szInfPath$ '' Set the size checking mode i% = SetSizeCheckMode(scmOnIgnore) '' Check that windows diectory is writable WindowsDir$ = GetWindowsDir() i% = IsDirWritable(WindowsDir$) if i% = 0 then '' Error: can't write to windows directory. exit. error ERR_BADWINDOWSPATH endif '' setup the ini path ExpertIniPath$ = MakePath(WindowsDir$, "CONTROL.INI") DOWELCOME: sz$ = UIStartDlg(UIDll$, WELCOME, "FInfoDlgProc", 0, "") if sz$ = "CONTINUE" then UIPop 1 else ConfirmQuit goto DOWELCOME end if '' Do the main thing GETPATH: '' Set up symbols as parameters for dialog box if mid$(WindowsDir$, 2, 1) = ":" then DefExpertPath$ = mid$(WindowsDir$, 1, 2) + "\XMOVIE" else DefExpertPath$ = "C:\XMOVIE" end if SetSymbolValue "EditTextIn", DefExpertPath$ SetSymbolValue "EditFocus", "ALL" GETPATHL1: sz$ = UIStartDlg(UIDll$, DESTPATH, "FEditDlgProc", 0, "") ExpertPath$ = GetSymbolValue("EditTextOut") if sz$ = "CONTINUE" then '' Make sure our target is writable if IsDirWritable(ExpertPath$) = 0 then error ERR_BADPATH '' will resume here err = 0 goto GETPATHL1 end if UIPop 1 elseif sz$ = "REACTIVATE" then goto GETPATHL1 else ConfirmQuit goto GETPATH end if SrcDir$ = GetSymbolValue("STF_SRCDIR") CreateDir ExpertPath$, cmoNone '' Determine the speed of the machine. For the moment ignore this and '' just use default for rate and simple size selection '' default for speed Rate$ = "30" '' select the size of the player Size$ = "320" Small$ = "0" STARTCOPYING: '' Add standard files to the copy list AddSectionFilesToCopyList "Expert", SrcDir$, ExpertPath$ AddSectionFilesToCopyList "Background", SrcDir$, MakePath(ExpertPath$, "backgrnd") AddSectionFilesToCopyList "Windows", SrcDir$, WindowsDir$ '' Determine if there is enough disk space for the installation. '' DiskSp& will be > 0 if there is NOT enough space. It will be 0 if there '' is sufficient free disk space for the installation SpaceCost& = GetCopyListCost(szExtra$,szCosts$, szNeeded$) '' Tell user how much more space is needed. if (SpaceCost& > 0) then SpaceCostKB% = SpaceCost& / 1000 sz$ = str$(SpaceCostKB%) SetSymbolValue "SpaceNeeded", sz$ sz$ = UIStartDlg(UIDll$, TOOBIG, "FTooBigDlgProc", 0, "") UIPop 1 error STFQUIT endif '' Copy the files CopyFilesInCopyList '' Set up the ini file CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "MoviePath", ExpertPath$, cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "CDROMPath", SrcDir, cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "ReelPath", MakePath(ExpertPath$, "movies.lst"), cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Rate", Rate$, cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Small", Small$, cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Playtype", "1", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "PreferredExt", ".avi", cmoOverwrite '' Specify the default backdrop as TV. 0=theater;1=TV;2=newspaper CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Background", "1", cmoOverwrite '' Set up the backdrop files CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Bitmap0", MakePath(ExpertPath$, "backgrnd\closeup.dib") + ",160,77", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Bitmap1", MakePath(ExpertPath$, "backgrnd\bigtv.dib") + ",178,178", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Bitmap2", MakePath(ExpertPath$, "backgrnd\bigpaper.dib") + ",147,129", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "BackgroundX", "178", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "BackgroundY", "178", cmoOverwrite '' Add NULL/default values for other INI file keys CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Tiled", "0", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "BackgroundPath", "", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "History0", "", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "History1", "", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "History2", "", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "History3", "", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "InsertAfter", "26918", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Random", "1", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Overlap", "1", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "Interval", "10", cmoOverwrite CreateIniKeyValue ExpertIniPath$, "Screen Saver.Expert", "PWProtected", "0", cmoOverwrite ''Create the progman groups and items ExpertExe$ = MakePath(ExpertPath$, "Expert.exe") ExpertSetup$ = ExpertExe$ ExpertRun$ = ExpertExe$ + " /s" CreateProgmanGroup "Expert Software", "", cmoNone ShowProgmanGroup "Expert Software", 1, cmoNone CreateProgmanItem "Expert Software", "Movie Clips Editor", ExpertSetup$, "", 1024 CreateProgmanItem "Expert Software", "Play Movie Clips", ExpertRun$, "", 1024 ExpertCredits$ = MakePath(ExpertPath$, "credits.wri") CreateProgmanItem "Expert Software", "Readme", ExpertCredits$, "", 1024 '' Exit with the proper dialog box QUIT: '' choose a dialog depending on exit error condition if err = 0 then dlg% = EXITSUCCESS ON ERROR GOTO VFW_ERRQUIT VFW_Init goto SKIPEXTWARNING EXTWARNING: sz$ = UIStartDlg(UIDll$, NEWEXTWARNING, "FInfo0DlgProc", 0, "") if sz$ = "REACTIVATE" then goto EXTWARNING end if UIPop 1 SKIPEXTWARNING: else dlg% = EXITQUIT end if QUITL1: '' display a dialog sz$ = UIStartDlg(UIDll$, dlg%, "FInfo0DlgProc", 0, "") if sz$ = "REACTIVATE" then goto QUITL1 end if UIPop 1 end HANDLEERROR: '' error handler select case ERR case ERR_BADCPU i% = DoMsgBox("This machine does not have a 80386 or above CPU.", "Expert Setup Error", MB_OK) case ERR_BADVGAMODE i% = DoMsgBox("This system is currently not capable of using 256 colors. Please install a 256 color device driver if available.", "Expert Setup Error", MB_OK) case ERR_BADPATH i% = DoMsgBox("The destination path is invalid. Please re-enter.", "Expert Setup Error", MB_OK) resume next case ERR_BADWINDOWSPATH i% = DoMsgBox("The Windows directory on this machine is unwritable.", "Expert Setup Error", MB_OK) case STFQUIT case STFERR case else i% = DoMsgBox("Fatal error.", "Expert Setup Error", MB_OK) end select goto QUIT '************************************************************************* '** '** Helper routines '** '************************************************************************* '** '** Purpose: '** Asks the user whether or not they really want to exit '** Arguments: '** None '************************************************************************* sub ConfirmQuit static ConfirmQuitStart: UIPopAll sz$ = UIStartDlg(UIDll$, ASKQUIT, "FQuitDlgProc", 0, "") if sz$ = "EXIT" then UIPopAll error STFQUIT elseif sz$ = "REACTIVATE" then GOTO ConfirmQuitStart else UIPopAll end if END SUB '** '** Purpose: '** Appends a file name to the end of a directory path, '** inserting a backslash character as needed. '** Arguments: '** szDir$ - full directory path (with optional ending "\") '** szFile$ - filename to append to directory '** Returns: '** Resulting fully qualified path name. '************************************************************************* function MakePath(szDir$, szFile$) static as string if szDir$ = "" then MakePath = szFile$ elseif szFile$ = "" then MakePath = szDir$ elseif mid$(szDir$, len(szDir$), 1) = "\" then MakePath = szDir$ + szFile$ else MakePath = szDir$ + "\" + szFile$ end if end function '' Determine size of the Windows color palette function GetColors() static as integer hdc% = GetDC(0) i% = GetDeviceCaps(hdc%, NUMCOLORS) dummy% = ReleaseDC(0, hdc%) GetColors = i% end function Sub VFW_Init Static VFW_CUIDLL$ = "mscuistf.dll" ''Custom user interface dll HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure WIN32ENABLED% = 0 MajorVer% = GetWindowsMajorVersion() MinorVer% = GetWindowsMinorVersion() Processor% = GetProcessorType() WinDir$ = GetWindowsDir() DEST$ = GetWindowsDir() WinSysDir$ = GetWindowsSysDir() WinSys32Dir$ = WinDir$ + "system32" IF MajorVer% < 3 OR (MajorVer% = 3 AND MinorVer% < 10) THEN i% = DoMsgBox("Microsoft Windows version 3.10 or greater is required for this software. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END END IF 'Prevents installation on 286 IF Processor% < 3 THEN i% = DoMsgBox("Video for Windows requires a 386 or greater processor or emulator.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END END IF ' Use Wowexec to determine version of NT. 3.1 did not stamp wowexec and wow returns 3.1 as version IF OnWindowsNT() THEN OnNT$ = "TRUE" WowVersion$ = GetVersionOfFile(WinSys32Dir$ + "\wowexec.exe") IF WowVersion$ = "" THEN i% = DoMsgBox("Video for Windows does not run on Windows NT 3.1. Please upgrade your version of Windows.", "Installation Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END END IF END IF WINDRIVE$ = MID$(GetWindowsDir, 1, 1) VFW_WELCOME: sz$ = UIStartDlg(VFW_CUIDLL$, WELCOME, "FInfoDlgProc", APPHELP, HELPPROC$) IF sz$ = "CONTINUE" THEN UIPop 1 ELSE GOSUB VFW_ASKQUIT GOTO VFW_WELCOME END IF ''Prepare Copy list and check size ClearCopyList SrcDir$ = GetSymbolValue("STF_SRCDIR") '' Runtime files (on Windows disk) '' Do not install OLE or MPlayer if on next release of NT or Windows IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN 'These files not necessary on Windows NT AddSectionFilesToCopyList "MPlayer", SrcDir$, WinDir$ AddSectionFilesToCopyList "OLE2", SrcDir$, WinSysDir$ END IF AddSectionFilesToCopyList "VfW Runtime", SrcDir$, WinSysDir$ AddSectionFilesToCopyList "ACM Drivers", SrcDir$, WinSysDir$ AddSectionFilesToCopyList "AVICodecs", SrcDir$, WinSysDir$ IF OnNT$ = "TRUE" THEN AddSectionFilesToCopyList "NT MSVideo", SrcDir$, WinSys32Dir$ ENDIF ''************************************************************************************************************************* ''************************************************************************************************************************* ''To add a DCI provider, please un-comment the AddSectionFilesToCopyList, ''and add a "DCI Provider" section with to the SETUP.INF file. '' '' AddSectionFilesToCopyList "DCI Provider", SrcDir$, WinSysDir$ ''************************************************************************************************************************* ''************************************************************************************************************************* '' Check windrive diskspace SizeReq& = GetCopyListCost ("","", "") IF SizeReq& <> 0 THEN GOSUB SMALLWIN END END IF VFW_Install '' Restart Windows: if it has to updates ACM from DOS, it restarts Windows automatically '' else, it gives the user the choice RESTRT% = RestartListEmpty () Exe$ = DEST$ + "\_msrstrt.exe" Batch$ = DEST$ + "\_mssetup.bat" empty$ = "" RESTART: IF RESTRT% = 0 THEN sz$ = UIStartDlg(VFW_CUIDLL$, RESTART, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO RESTART ENDIF I% = ExitExecRestart () RemoveFile Exe$, cmoForce RemoveFile Batch$, cmoForce END ELSE sz$ = UIStartDlg(VFW_CUIDLL$, RESTARTII, "FQuitDlgProc", 0, "") IF sz$ = "CONTINUE" THEN I% = ExitWindowsExec (Exe$, empty$) IF I% = 0 THEN GOTO RESTART ELSE END ENDIF ELSEIF sz$ = "EXIT" THEN UIPopAll END ELSEIF sz$ = "REACTIVATE" THEN GOTO RESTART ELSE UIPop 1 END IF END IF VFW_QUIT: IF ERR = 0 THEN dlg% = EXITSUCCESS goto SKIPGOSUBS ELSEIF ERR = STFQUIT THEN dlg% = EXITQUIT ELSE dlg% = EXITFAILURE END IF VFW_QUITL1: sz$ = UIStartDlg(VFW_CUIDLL$, dlg%, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO VFW_QUITL1 END IF UIPop 1 GOTO SKIPGOSUBS VFW_ASKQUIT: sz$ = UIStartDlg(VFW_CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "") IF sz$ = "EXIT" THEN UIPopAll '' ERROR STFQUIT END ELSEIF sz$ = "REACTIVATE" THEN GOTO VFW_ASKQUIT ELSE UIPop 1 END IF RETURN SMALLWIN: sz$ = UIStartDlg(VFW_CUIDLL$, SMALLWIN, "FInfo0DlgProc", 0, "") IF sz$ = "REACTIVATE" THEN GOTO SMALLWIN END IF UIPop 1 RETURN SKIPGOSUBS: END SUB VFW_ERRQUIT: i% = DoMsgBox("An installation problem occured, call the product support service", "Setup Problem", MB_OK+MB_TASKMODAL+MB_ICONHAND) END '** '** Purpose: '** Performs all installation operations. '** Arguments: '** none. '** Returns: '** none. '************************************************************************* SUB VFW_Install STATIC SetRestartDir WinDir$ CopyFilesInCopyList ''Updating WIN.INI and SYSTEM.INI ''Only update SYSTEM.INI on NT or next version of Windows for other codecs IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN IF VflatdPresent() = 0 THEN CreateSysIniKeyValue WinDir$ + "system.ini", "386Enh", "device", "dva.386", cmoOverwrite END IF END IF CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite I% = DoesIniKeyExist (WinDir$ + "system.ini", "Drivers", "VIDC.RT21") IF I% = 0 THEN CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.RT21", "ir21_r.dll", cmoOverwrite END IF CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "VIDC.YVU9", "ir21_r.dll", cmoOverwrite CreateIniKeyValue WinDir$ + "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite CreateIniKeyValue WinDir$ + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite ''************************************************************************************************************************* ''************************************************************************************************************************* ''To add a DCI provider, please un-comment the UDH line, and un-comment and replace the <provider> with your own file name '' '' CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "DCI", "<provider>", cmoOverwrite '' CreateIniKeyValue WinDir$ + "system.ini", "Drivers", "vids.draw", "udh.dll", cmoOverwrite ''************************************************************************************************************************* ''************************************************************************************************************************* ''Do not register components not installed with Video for Windows on NT or next version of Windows. IF ((NOT OnNT$ = "TRUE") AND MinorVer% < 50) THEN Run ("regedit.exe /s " + MakePath(WinDir$, "mplayer.reg")) Run ("regedit.exe /s " + MakePath(WinSysDir$, "OLE2.reg")) Run ("regedit.exe /s " + MakePath(WinSysDir$, "cleanup.reg")) '' Mplayer CreateProgmanItem "Accessories", "Media Player", MakePath(WinDir$, "mplayer.exe"), "", cmoOverwrite END IF ''NT and next version of Windows installation stop here. Run ("profdisp.exe") END SUB